---
title: "Analysis On Footballers"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
source_code: embed
theme: cerulean
---
```{r setup, include=FALSE}
library(flexdashboard)
library(dplyr)
library(ggplot2)
library(DT)
sonuc <- read.csv("result.csv")
sonuc_ <-distinct(sonuc, cleaned_names, .keep_all = TRUE)
sonuc_
library(dplyr)
yeni <- sonuc_ %>%
select(cleaned_names , Age, cleaned_teams,Height,Weight,foot ,Best.overall,Best.position, Growth,Value,Wage,Release.clause) %>%
rename(Names = cleaned_names, Teams = cleaned_teams, Foot = foot)
yeni$age_group <- cut(yeni$Age, breaks = c(0,18, 25, 30, 40, max(yeni$Age)), labels = c("Under 18", "Young", "Middle-aged", "Old", "Very Old"))
```
# Start
Column {data-width=250 .tabset}
-----------------------------------------------------------------------
### Scatter Plot
```{r}
# bu bir grafik
ggplot(yeni, aes(x = Best.overall, y = Value)) +
geom_point(aes(color = Value, size = Value), alpha = 0.5) + # Noktaları mavi renkte ve boyut 3 yapma
scale_color_gradient(low = "blue", high = "red", name = "Value")+
labs(title = "Potential vs Value Scatter Plot", x = "Potential", y = "Value") + # Başlık ve eksen etiketleri ekleme
theme_minimal()
```
### Interactive Pie Plot
```{r}
library(plotly)
library(dplyr)
pozisyon_frekans <- table(yeni$Best.position)
# Veri çerçevesi oluşturma
df <- data.frame(
pozisyon = names(pozisyon_frekans),
frekans = as.numeric(pozisyon_frekans)
)
# Pasta grafiği oluşturma
plot_ly(
data = df,
labels = ~pozisyon,
values = ~frekans,
type = "pie"
) %>%
layout(
title = "Distribution of Positions Played by Footballers",
showlegend = TRUE,
legend = list(title = list(text = 'Positions')),
marker = list(
colors = c("#FF3333", "#FF9933", "#FFCC66", "#99FF66", "#66CCCC", "#3399FF", "#9966FF", "#FF66B2", "#FF6699", "#FF3333", "#FF9933", "#FFCC66", "#99FF66", "#66CCCC", "#3399FF", "#9966FF", "#FF66B2")
)
)
# Futbolcuların poziyonlarına göre oluşturulan pasta grafiği
```
Column {data-width=250}
-----------------------------------------------------------------------
### Histogram Plot
```{r fig.width = 12, fig.height= 5}
ggplot(sonuc, aes(x = Best.overall)) +
geom_histogram(binwidth = 0.99, fill = "skyblue", color = "black") +
labs(title = "Distribution Of Overall Ratings Achieved By Footballers", x = "Best Potential", y = "Frequency") +
theme(
plot.background = element_rect(fill = "transparent", color = NA),
panel.background = element_rect(fill = "transparent", color = NA)
) +
theme(
plot.title = element_text(size = 20),
axis.title.x = element_text(size = 16),
axis.title.y = element_text(size = 16),
axis.text.x = element_text(size = 14),
axis.text.y = element_text(size = 14),
legend.title = element_text(size = 16),
legend.text = element_text(size = 14)
)
#Distribution Of Overall Ratings Achieved By Footballers
```
### Bar Plot
```{r fig.width = 12, fig.height= 5}
library(plotly)
bar<-ggplot(yeni, aes(x = age_group, fill = age_group)) +
geom_bar() +
theme_minimal() +
labs(title = "Bar Plot of Player Ages by Age Group",
x = "Age Group",
y = "Count",
fill = "Age Group") +
scale_fill_manual(values = c("#FF6F61", "#6B5B95", "#88B04B", "#F7CAC9", "#92A8D1"))+
theme(
plot.title = element_text(size = 20),
axis.title.x = element_text(size = 16),
axis.title.y = element_text(size = 16),
axis.text.x = element_text(size = 14),
axis.text.y = element_text(size = 14),
legend.title = element_text(size = 16),
legend.text = element_text(size = 14)
)
bar
```
# Info Data
Row {data-height=450}
-------------------------------------
### Dataset
```{r}
library(DT)
datatable(yeni, options = list(
pageLength = 10,
editable = 'cell'
))
```
Row {data-height=350}
-------------------------------------
### List of the variable names
```{r}
#variables <- data.frame("Variable Names" = names(yeni))
#datatable(variables, options = list(dom = 't'))
library(DT)
variables <- data.frame("Variable Names" = names(yeni))
datatable(variables, options = list(dom = 't')) %>%
formatStyle(columns = names(variables), fontSize = '10px')
```
### Main summary of the data
```{r fig.width = 5, fig.height= 5}
library(kableExtra)
summary_data <- summary(yeni)
de_stat<-yeni %>%
select(-Names,-Teams,-Foot,-Best.position,-age_group)%>%
summary() %>%
knitr::kable() %>%
kable_styling(font_size = 10)
de_stat
#datatable(summary_data)
```
# About me
### Panel including these information
```{r}
library(DT)
library(tibble)
# Verileri oluşturma ve değişken isimlerini İngilizce yapma
veri <- tibble(
Name = "Kamil Göçer",
Number = 666,
Date = as.Date("2024-06-09"),
Dataset_Name = "players_3120.csv"
)
library(DT)
library(tibble)
library(gt)
# Verileri oluşturma ve değişken isimlerini İngilizce yapma
veri <- tibble(
Name = "Kamil Göçer",
Number = 666,
Date = as.Date("2024-06-09"),
Dataset_Name = "players_3120.csv"
)
veri %>%
gt() %>%
tab_header(
title = "Bilgilerim"
)
```